package frontend.model.admin;

import backend.model.admin.Department;
import frontend.model.base.UIModel;

public class DepartmentUIModel implements UIModel<Department> {

    private String name;
    private boolean isActive;

    private Department department;

    public DepartmentUIModel() {
        department= new Department();
        isActive = true;
    }

    public DepartmentUIModel(Department department) {
        this.department= department;
        populateFieldsFromDBModel();
    }

    @Override
    public void populateFieldsFromDBModel() {
        name = department.getName();
        isActive = department.getIsActive();
    }

    @Override
    public void populateDBModelFromFields() {
        department.setName(name);
        department.setIsActive(isActive);
    }

    public String getName() {
        return name;
    }

    @Override
    public Department getDBModel() {
        return department;
    }
}
